package com.gitee.tianchaohongyu.jdcl.configuration;

import com.gitee.tianchaohongyu.jdcl.aspect.CleanAspect;
import com.gitee.tianchaohongyu.jdcl.core.CleanService;
import com.gitee.tianchaohongyu.jdcl.core.CleanServiceDefaultImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;


/**
 * 数据清洗器自动配置
 */
@Configuration
@Import(CleanAspect.class)
@EnableConfigurationProperties(JdclProperties.class)
public class JdclAutoConfiguration {

  private Logger logger = LoggerFactory.getLogger(JdclAutoConfiguration.class);

  @Bean
  @ConditionalOnMissingBean(CleanService.class)
  public CleanService cleanService() {
    logger.info("创建数据清洗器服务。");
    return new CleanServiceDefaultImpl();
  }
}
